<#assign menu="merchant">
<#assign submenu="merchant_list">
<#include "/system/head.ftl">
<style type="text/css" xmlns="http://www.w3.org/1999/html">
    .pagination {
        border-radius: 4px;
        display: inline-block;
        margin: 0;
        padding-left: 0;
    }

    /* Portlet */
    .portlet > .portlet-body.green,
    .portlet.green {
        background-color: white;
    }
</style>

<body>

<section id="main-content">
    <section class="wrapper">


        <section class="panel">

            <div class="tab-content">

                <div class="tab-pane active" id="tab_2">
                    <div class="portlet box green">
                        <div class="portlet-title">
                            <div class="caption">
                                <i class="fa fa-gift"></i>商户列表
                            </div>
                        </div>
                        <div class="portlet-body">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <form method="post" action="${basePath}/admin/merchant/toSearch.htm">
                                            <div class="row">
                                                <div class="col-md-3">
                                                    <label class="control-label col-md-4"
                                                           style="font-size: 16px;"><nobr>商户类型 </nobr></label>

                                                    <div class="col-md-8">
                                                        <select name="merchantType" id="merchantType-select" class="form-control" >
                                                        <#list merchantCategoryList as e>
                                                            <option value=${e.id}>${e.name}</option>
                                                        </#list>
                                                        </select>
                                                    </div>
                                                </div>
                                                <div class="col-md-3">
                                                    <label class="control-label col-md-4"
                                                           style="font-size: 16px;"><nobr>商户名称</nobr> </label>

                                                    <div class="input-group col-md-8">
                                                        <input type="text" class="form-control" name="merchantName" value="${merchantName}" id="merchantName">


                                                    </div>
                                                </div>
                                                <div class="col-md-4">
                                                    <label class="control-label col-md-3" style="font-size: 16px;">
                                                        <nobr>商户地址</nobr></label>

                                                    <div class="col-md-9" id="city_2">
                                                        <div class="row">
                                                            <select name="province" class="prov   bs-select input-default"
                                                                    data-style="btn-primary" style="height: 34px;" ></select>
                                                            <select name="city" class="city   bs-select input-default"

                                                                    data-style="btn-primary" style="height: 34px;"></select>
                                                            <select name="area" class="dist   bs-select input-default"

                                                                    data-style="btn-primary" style="height: 34px;"></select>
                                                            <input type="text" name="address"
                                                                   id="address" style="height: 34px">
                                                        </div>
                                                    </div>
                                                </div>


                                                <div class="input-group-btn col-md-2">
                                                    <button id="genpassword" class="btn btn-success" type="submit"
                                                            ><i class="fa fa-arrow-left fa-fw"></i>
                                                        查询
                                                    </button>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>


                            <div class="panel-body">
                                <div class="adv-table">
                                    <div role="grid" class="dataTables_wrapper" id="hidden-table-info_wrapper">
                                        <table class="table table-striped table-advance table-hover">
                                            <thead>
                                            <tr>
                                                <th  nowrap>ID</th>
                                                <th nowrap>商户类型</th>
                                                <th nowrap>商户名称</th>
                                                <th nowrap>是否认证</th>
                                                <th nowrap>评分</th>
                                                <th nowrap>联系方式</th>
                                                <th nowrap>联系电话</th>
                                                <th nowrap>座机号</th>
                                                <th nowrap>商户地址</th>
                                                <th nowrap>通过审核</th>
                                                <#--<th>业务描述</th>-->
                                                <th nowrap>操作</th>
                                            </tr>
                                            </thead>
                                            <tbody role="alert" aria-live="polite" aria-relevant="all">
                                            <#list pageVo.list as e>
                                            <tr class="merchant list" id="merchant_${e.id}">
                                                <td>${e.id}</td>
                                                <td >
                                                    <#if "${e.merchantType}" = "1">
                                                        互联网
                                                    <#elseif "${e.merchantType}" = "2">
                                                        餐饮服务
                                                    <#elseif "${e.merchantType}" = "3">
                                                        旅游
                                                    <#elseif "${e.merchantType}" = "4">
                                                        电子制造
                                                    <#elseif "${e.merchantType}" = "5">
                                                        娱乐服务
                                                    </#if>
                                                </td>
                                                <td >${e.merchantName}</td>

                                                <td >
                                                    <#if "${e.isAttestation}" = "yes">
                                                        是
                                                    <#else>
                                                        否
                                                    </#if>
                                                </td>


                                                <td >${e.score}</td>
                                                <td >${e.contact}</td>
                                                <td >${e.contact_tel}</td>
                                                <td >${e.fixed_tel}</td>
                                                <td>${e.province}省${e.city}市${e.area}${e.address}</td>
                                                <td>
                                                    <#if "${e.status}" = "audit">
                                                        是
                                                    <#else>
                                                     否
                                                    </#if>
                                                </td>
                                                <#--<#if "${e.description}"?length gt  20>-->
                                                    <#--<td>${e.description?substring(0,20)}...</td>-->
                                                <#--<#else>-->
                                                    <#--<td>${e.description}</td>-->
                                                <#--</#if>-->

                                                <td>
                                                    <a href="${basePath}/admin/merchant/detail.htm?merchantId=${e.id}"
                                                       title="修改">
                                                        编辑
                                                    </a>
                                                    <a class="js_delete_merchant" href="javascript:void(0);"
                                                       uid="${e.id}" title="删除">
                                                        删除
                                                    </a></td>
                                            </tr>
                                            </#list>
                                            </tbody>
                                        </table>
                                        <div style="height: 30px;">
                                            <div class="pagination">${pageVo.pageNumHtml} </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>


        </section>
    </section>
</section>


</body>
<script>

    $(function () {
        $(".js_userId").hide();
    });


    $('.js_delete_merchant').click(function () {
        var uid = $(this).attr('uid');
        bootbox.dialog({
            message: "是否" + $(this).attr('title'),
            title: "提示",
            buttons: {
                "delete": {
                    label: "确定",
                    className: "btn-success",
                    callback: function () {
                        $.get("${basePath}/admin/merchant/delete.json", {"merchantId": uid}, function (data) {

                            console.log(data);
                            $("#merchant_" + uid).remove();

                            //                        window.location.reload();
                        });
                    }
                },
                "cancel": {
                    label: "取消",
                    className: "btn-primary",
                    callback: function () {

                    }
                }
            }
        });
    });

</script>

<script src="${basePath}/system/js/jquery.cityselect.js"></script>
<script>
    $("#city_2").citySelect({
        prov:"",
        nodata: "none"
    });
</script>
<#include "/system/foot.ftl">

<#--选择器初始化-->
<script>
    $("#merchantType-select").val("");
//    initFileUpload();
</script>

